/*
 * SubmitOrderSuccessActivity.java
 * business
 *
 * Created by chentao on 2017/5/9.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.main.shoppingcart.multipayways;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.constant.Intents;
import com.yidiandao.business.data.model.ConfirmOrderModel;
import com.yidiandao.business.utils.ActivityUtils;

/**
 * 订单提交成功-Activity.
 */
public class MultiPayWaysActivity extends BaseActivity {

    private MultiPayWaysFragment mMultiPayWaysFragment;

    public static void actionStart(Activity activity, String orderPayId) {
        Intent intent = new Intent(activity, MultiPayWaysActivity.class);
        intent.putExtra(Intents.EXTRA_ORDER_PAY_ID, orderPayId);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mMultiPayWaysFragment = (MultiPayWaysFragment) getSupportFragmentManager().findFragmentById(R.id.container_multi_payways);

        if (mMultiPayWaysFragment == null) {
            mMultiPayWaysFragment = MultiPayWaysFragment.getInstance();
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), mMultiPayWaysFragment, R.id.container_multi_payways);
        }

    }

    @Override
    protected void initPresenter() {
        new MultiPayWaysPresenter(mMultiPayWaysFragment, new ConfirmOrderModel(), getIntent().getExtras());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_multi_payways;
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();

        mMultiPayWaysFragment.onBackPress();
    }
}
